/***********************************************************************
** Copyright (C) 2011 Anthony Naddeo <anthony.naddeo@gmail.com>
**
** This file is part of linkedup
**
** linkedup is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 3 of the License, or
** (at your option) any later version.
**
** linkedup is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this package; If not, see <http://www.gnu.org/licenses/>.
**
***********************************************************************/

#include <QtGui/QApplication>
#include <QtDeclarative>

#include "authorizer.h"
#include "settings.h"
#include "linkedinapi.h"
#include "user.h"

#include <MDeclarativeCache>

Q_DECL_EXPORT int main(int argc, char *argv[])
{

	QApplication *app = MDeclarativeCache::qApplication(argc, argv);
	QDeclarativeView *view = MDeclarativeCache::qDeclarativeView();

	/*classes designed for use in qml*/
	Authorizer auth;
	Settings settings;
	LinkedInAPI api;
	User user;

	view->rootContext()->setContextProperty("OAuth", &auth);
	view->rootContext()->setContextProperty("Settings", &settings);
	view->rootContext()->setContextProperty("API", &api);
	view->rootContext()->setContextProperty("User", &user);

	view->setSource(QUrl("qrc:/qml/main.qml"));
	view->showFullScreen();
	return app->exec();
}


////main without MDeclarativeCache
//#include <QtGui/QApplication>
//#include <QtDeclarative>

//#include "authorizer.h"
//#include "settings.h"
//#include "linkedinapi.h"
//#include "user.h"

//int main(int argc, char *argv[])
//{
//	QApplication app(argc, argv);
//	QDeclarativeView view;


//	/*classes designed for use in qml*/
//	Authorizer auth;
//	Settings settings;
//	LinkedInAPI api;
//	User user;

//	view.rootContext()->setContextProperty("OAuth", &auth);
//	view.rootContext()->setContextProperty("Settings", &settings);
//	view.rootContext()->setContextProperty("API", &api);
//	view.rootContext()->setContextProperty("User", &user);

//	view.setSource(QUrl("qrc:/qml/main.qml"));
//	view.showFullScreen();
//	return app.exec();
//}
